from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.ext.asyncio import AsyncSession
from .post import router as post_router
from .auth import router as auth_router
from app.database import get_db

router = APIRouter(prefix="/api")

router.include_router(post_router, tags=["活动"])
router.include_router(auth_router, tags=["认证"])

@router.get("/activity/form/{id}/isSignUp")
async def check_sign_up(
    id: int,
    # current_user: dict = Depends(get_current_user),
    db: AsyncSession = Depends(get_db),
):
    return {"code": 10000, "data": False}
    

@router.get("/checkLogin")
async def check_login():
    """检查用户登录状态"""
    return {"code": 10000, "data": "success"}


@router.get("/actions")
async def get_actions():
    """获取系统操作列表"""
    try:
        # 这里可以从配置文件或数据库中获取操作列表
        calender_src1 = "https://www.google.com/logos/doodles/2023/celebrating-the-first-landing-on-the-moons-south-pole-6753651837110163.3-law.gif"
        actions = [
            {
                "icon": "/assets/home-icons/calendar.svg",
                "src": [calender_src1, "2"],
                "title": "校历",
            },
            {
                "icon": "/assets/home-icons/map.svg", 
                "src": ["1", "2"], 
                "title": "地图"
            },
            {
                "icon": "/assets/home-icons/address_book.svg",
                "src": ["1", "2"],
                "title": "电话本"
            },
            {
                "icon": "/assets/home-icons/schedule.svg",
                "src": ["1", "2"],
                "title": "时间表"
            }
        ]

        return {"code": 10000, "data": actions}
    except Exception as e:
        raise HTTPException(status_code=500, detail={"code": 50000, "data": str(e)})